#!/bin/bash

####################################### DenyHosts #######################################

yum install -y wget

# 获取源码
wget http://bcs.duapp.com/mogu-source/product/denyhosts/DenyHosts-2.6.tar.gz

# 解压并安装
tar zxvf DenyHosts-2.6.tar.gz
cd DenyHosts-2.6
python setup.py install

# 清理文件
cd ..
rm -rf DenyHosts-2.6

# 配置文件
cd /usr/share/denyhosts/
cp denyhosts.cfg-dist denyhosts.cfg

# 注册服务
cp daemon-control-dist daemon-control
chmod 700 daemon-control
ln -s /usr/share/denyhosts/daemon-control /etc/init.d/denyhosts

# 开机启动
chkconfig denyhosts on

# 启动DenyHosts
service denyhosts start
